home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJINC106.ARJ / FSTREAM.H < prev    next >
C/C++ Source or Header  |  1992-03-29  |  2KB  |  68 lines

  1. //    This is part of the iostream library, providing input/output for C++.
  2. //    Copyright (C) 1991 Per Bothner.
  3. //
  4. //    This library is free software; you can redistribute it and/or
  5. //    modify it under the terms of the GNU Library General Public
  6. //    License as published by the Free Software Foundation; either
  7. //    version 2 of the License, or (at your option) any later version.
  8. //
  9. //    This library is distributed in the hope that it will be useful,
  10. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. //    Library General Public License for more details.
  13. //
  14. //    You should have received a copy of the GNU Library General Public
  15. //    License along with this library; if not, write to the Free
  16. //    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  17.  
  18. #ifndef _FSTREAM_H
  19. #define _FSTREAM_H
  20. #ifdef __GNUG__
  21. #pragma interface
  22. #endif
  23. #include <iostream.h>
  24.  
  25. class ifstream : public istream {
  26.   public:
  27.     ifstream();
  28.     ifstream(int fd);
  29.     ifstream(const char *name, int mode=ios::in, int prot=0664);
  30.     void open(const char *name, int mode=ios::in, int prot=0664);
  31.     void close();
  32.     filebuf* rdbuf() const { return (filebuf*)_strbuf; }
  33. #ifdef _STREAM_COMPAT
  34.     int filedesc() { return rdbuf()->fd(); }
  35.     ifstream& raw() { rdbuf()->setbuf(NULL, 0); return *this; }
  36. #endif
  37. };
  38.  
  39. class ofstream : public ostream {
  40.   public:
  41.     ofstream();
  42.     ofstream(int fd);
  43.     ofstream(const char *name, int mode=ios::out, int prot=0664);
  44.     void open(const char *name, int mode=ios::out, int prot=0664);
  45.     void close();
  46.     filebuf* rdbuf() const { return (filebuf*)_strbuf; }
  47. #ifdef _STREAM_COMPAT
  48.     int filedesc() { return rdbuf()->fd(); }
  49.     ofstream& raw() { rdbuf()->setbuf(NULL, 0); return *this; }
  50. #endif
  51. };
  52.  
  53. class fstream : public iostream {
  54.   public:
  55.     fstream();
  56.     fstream(int fd);
  57.     fstream(const char *name, int mode, int prot=0664);
  58.     void open(const char *name, int mode, int prot=0664);
  59.     void close();
  60.     filebuf* rdbuf() const { return (filebuf*)_strbuf; }
  61. #ifdef _STREAM_COMPAT
  62.     int filedesc() { return rdbuf()->fd(); }
  63.     fstream& raw() { rdbuf()->setbuf(NULL, 0); return *this; }
  64. #endif
  65. };
  66. #endif /*!_FSTREAM_H*/
  67.  
  68.